package eventbus

import (
	"github.com/asaskevich/EventBus"
)

var globalEventBus EventBus.Bus

func init() {
	globalEventBus = EventBus.New()
}

func Subscribe(topic string, fn any) error {
	return globalEventBus.Subscribe(topic, fn)
}

func SubscribeAsync(topic string, fn any, transactional bool) error {
	return globalEventBus.SubscribeAsync(topic, fn, transactional)
}

func Publish(topic string, args ...any) {
	globalEventBus.Publish(topic, args...)
}
